package com.le.tester.onjava8.l_2_2_6;

/**
 * createTime：2023/1/7 17:36
 * description：深度克隆测试
 */
public class DeepCopyTester {

    public static void main(String[] args) {
        OceanReading oceanReading = new OceanReading(33.9, 100.5);

        //进行克隆
        OceanReading clone = oceanReading.clone();

        TemperatureReading tr = clone.getTemperatureReading();

        tr.setTemperature(tr.getTemperature() + 1);

        clone.setTemperatureReading(tr);

        DepthReading dr = clone.getDepth();

        dr.setDepth(dr.getDepth() + 1);

        clone.setDepth(dr);


    }
}
